import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/ '
  },
  {
    path: '/login',
    name: 'loginIndex',
    component: () => import('@/views/login')
  },
  {
    path: '/ ',
    name: 'layoutIndex',
    component: () => import('@/views/layout'),
    children: [
      {
        path: '/home',
        name: 'homeIndex',
        component: () => import('@/views/home')
      },
      {
        path: '/house',
        name: 'houseIndex',
        component: () => import('@/views/seekHouse')
      },
      {
        path: '/consult',
        name: 'consultIndex',
        component: () => import('@/views/consult')
      },
      {
        path: '/my',
        name: 'myIndex',
        component: () => import('@/views/my')
      }
    ]
  },
  {
    path: '/city',
    name: 'cityIndex',
    component: () => import('@/views/city')
  },
  {
    path: '/map',
    name: 'mapIndex',
    component: () => import('@/views/map')
  },
  {
    path: '/detail',
    name: 'detailIndex',
    component: () => import('@/views/detail')
  },
  {
    path: '/favorate',
    name: 'favorateIndex',
    component: () => import('@/views/favorate')
  },
  {
    path: '/rent',
    name: 'rentIndex',
    component: () => import('@/views/rent')
  },
  {
    path: '/add',
    name: 'addIndex',
    component: () => import('@/views/addNewHouse')
  },
  {
    path: '/search',
    name: 'searchIndex',
    component: () => import('@/views/search')
  }
]

const router = new VueRouter({
  routes
})

export default router
